package websocket

import (
	"github.com/gorilla/websocket"
	"net/http"
)

type Upgrader struct {
	upgrader *websocket.Upgrader
}

func NewUpgrader() *Upgrader {
	return &Upgrader{
		upgrader: &websocket.Upgrader{
			ReadBufferSize:  1024,
			WriteBufferSize: 1024,
			CheckOrigin: func(r *http.Request) bool {
				return true
			},
		},
	}
}

func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error) {
	return u.upgrader.Upgrade(w, r, nil)
}
